/**
 * 
 * select.js
 * 模拟下拉列表
 * 注意点：checkedOne为选中内容，显示在select容器中
 * 
 * @author: 么苋木偶
 * @time: 2017/3/14 10:59
 * 
 * */

var optionCheckedOne = $('.checkedOne').html();
var optionCheckedTwo = $('.checkedTwo').html();
var optionCheckedThree = $('.checkedThree').html();
var selectDown = $('#selectDown').val();
var selectUp = $('#selectUp').val();
var showOne = true;
var showTwo = true;
var showThree = true;
$('.select').html(optionCheckedOne);
$('.select').on('click',function(){
	console.log('click');
	if(showOne){
		console.log('clickShow');
		$('.opationWrap').show();
		$('.select').css('background-image',selectUp);
		showOne = false;
	}else{
		console.log('clickHide');
		$('.opationWrap').hide();
		$('.select').css('background-image',selectDown);
		showOne = true;
	}
})
$('.opationWrap .opation').on('click',function(){
	$(this).addClass('checkedOne');
	$(this).siblings().removeClass('checkedOne');
	optionCheckedOne = $('.checkedOne').html();
	$('.select').html(optionCheckedOne);
	if(showOne){
		$('.opationWrap').show();
		$('.select').css('background-image',selectUp);
		showOne = false;
	}else{
		$('.opationWrap').hide();
		$('.select').css('background-image',selectDown);
		showOne = true;
	}
})


$('.selectTwo').html(optionCheckedTwo);
$('.selectTwo').on('click',function(){
	if(showTwo){
		$('.opationWrapTwo').show();
		$('.selectTwo').css('background-image',selectUp);
		showTwo = false;
	}else{
		$('.opationWrapTwo').hide();
		$('.selectTwo').css('background-image',selectDown);
		showTwo = true;
	}
})
$('.opationWrapTwo .opation').on('click',function(){
	$(this).addClass('checkedTwo');
	$(this).siblings().removeClass('checkedTwo');
	optionCheckedTwo = $('.checkedTwo').html();
	$('.selectTwo').html(optionCheckedTwo);
	if(showTwo){
		$('.opationWrapTwo').show();
		$('.selectTwo').css('background-image',selectUp);
		showTwo = false;
	}else{
		$('.opationWrapTwo').hide();
		$('.selectTwo').css('background-image',selectDown);
		showTwo = true;
	}
})


$('.selectThree').html(optionCheckedThree);
$('.selectThree').on('click',function(){
	if(showThree){
		$('.opationWrapThree').show();
		$('.selectThree').css('background-image',selectUp);
		showThree = false;
	}else{
		$('.opationWrapThree').hide();
		$('.selectThree').css('background-image',selectDown);
		showThree = true;
	}
})
$('.opationWrapThree .opation').on('click',function(){
	$(this).addClass('checkedThree');
	$(this).siblings().removeClass('checkedThree');
	optionCheckedThree = $('.checkedThree').html();
	$('.selectThree').html(optionCheckedThree);
	if(showThree){
		$('.opationWrapThree').show();
		$('.selectThree').css('background-image',selectUp);
		showThree = false;
	}else{
		$('.opationWrapThree').hide();
		$('.selectThree').css('background-image',selectDown);
		showThree = true;
	}
})
